import type { ProColumns, ProFormColumnsType } from '@ant-design/pro-components';
export const TABLE_COLUMNS: ProColumns<any>[] = [
  {
    title: '序号',
    dataIndex: 'index',
    valueType: 'indexBorder',
    width: 45,
  },
  {
    title: '姓名',
    dataIndex: 'nickName',
  },
  {
    title: '账号',
    dataIndex: 'username',
  },
  {
    title: '手机号码',
    dataIndex: 'phone',
    hideInSearch: true,
  },
  {
    title: '邮箱',
    dataIndex: 'email',
    hideInSearch: true,
  },
  {
    title: '创建日期',
    dataIndex: 'createDate',
    hideInSearch: true,
    hideInForm: true,
  },
];
export const FORM_COLUMNS: ProFormColumnsType<any>[] = [
  {
    title: '账号',
    dataIndex: 'username',
    formItemProps: {
      rules: [
        { required: true },
        { pattern: /^[a-zA-Z0-9]+$/, message: '只能输入大小写字母和数字' },
      ],
    },
  },
  {
    title: '姓名',
    dataIndex: 'nickName',
    formItemProps: {
      rules: [
        { required: true },
        { pattern: /^[\u4e00-\u9fa5]+$/, message: '只能输入中文！' },
      ],
    },
  },
  {
    title: '手机号码',
    dataIndex: 'phone',
    formItemProps: {
      rules: [
        { required: true },
        { pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/, message: '格式错误！' },
      ],
    },
  },

  {
    title: '邮箱',
    dataIndex: 'email',
    formItemProps: {
      rules: [
        { required: true },
        {
          type: 'email', //string |number |boolean |url | email | regexp
          message: '格式错误！',
        },
      ],
    },
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    hideInForm: true,
  },
];
